#pragma once
#include "BasicObject.h"
#include "UIClass.h"
class OgreWidget;
class MeshObjectBase
{
public:
	struct suDrawMesh
	{
		SharedPointer<MeshData> m_pMeshData;
		ZMString m_strMatName;
		ZMString m_strNodeName;
	};

	MeshObjectBase(ZMString strObjName);
	~MeshObjectBase();

	virtual ZMVector<SharedPointer<UIDataBase>> GetParam() = 0;

	virtual void SetParam(const ZMVector<SharedPointer<UIDataBase>>& vParam);

	ZMString GetObjName() const { return m_strObjName; }

	void SetObjName(ZMString val) { m_strObjName = val; }
	
	void UpdateMeshData(OgreWidget * pWidget, const ZMString& meshName = "", const ZMString& parentNodeName="");

	virtual bool IsVaid() const
	{
		return true;
	}
protected:
	virtual void SetParamCore(const ZMVector<SharedPointer<UIDataBase>>& vParam) = 0;

	virtual ZMVector<suDrawMesh> GetMeshData(const ZMString& strMeshName="") = 0;

	bool GetNeedUpdateMesh() const { return m_isNeedUpdateMesh; }
	
	void SetNeedUpdateMesh(bool val) { m_isNeedUpdateMesh = val; }
private:
	atomic<bool> m_isNeedUpdateMesh;
	ZMString m_strObjName;
};
typedef SharedPointer<MeshObjectBase> PMeshObjectBase;

